﻿@{
    Layout = null;
    List<string> olderAnalysis = (List<string>)ViewBag.OlderDailyAnalysisTimes;
}
<table border="1" cellspacing="5" cellpadding="5" class="advanced-tbl" style="width: 400px">
    <thead>
        <tr>
            <th colspan="3">
                Older Analysis :
            </th>
            <th colspan="7">
                <select id="olderAnalysis" name="olderAnalysis" onchange="setDailyAnalysisDate();">
                    <option value="">Today</option>
                    @{
                        string currenDate = Session["CurrentAnalysisDate"] != null ? Session["CurrentAnalysisDate"].ToString() : string.Empty;
                    }
                    @foreach(string analysis in olderAnalysis)
                    {
                        
                        string selected = (analysis.Replace(".", string.Empty) == currenDate ? "selected" : string.Empty);
                        <option value="@(analysis.Replace(".", string.Empty))" @selected>@(analysis)</option>
                    }
                </select>
            </th>
        </tr>
        <tr>
            <th>
                Order
            </th>
            <th>
                Product
            </th>
            <th>
                Target
            </th>
            <th>
                Potential<br/>Direction
            </th>
            <th>
                Support
            </th>
            <th>
                Resistance
            </th>
            <th>
                Expiry
            </th>
            <th>
                KeyLevel
            </th>
            <th>
                Alternative<br/>Scenario
            </th>
            <th>
                Note
            </th>
        </tr>
    </thead>
    <tbody>
        @if (((List<Century.Models.Common.DailyAnalysis>)ViewBag.DailyAnalysisList).Count > 0)
        {
            foreach (Century.Models.Common.DailyAnalysis item in ViewBag.DailyAnalysisList)
            {
            <tr>
                <td><b>@item.Order</b></td>
                <td>@item.Product</td>
                <td>@item.Target</td>
                <td>
                    @if ((Century.Common.Enumerations.DailyAnalysisPotentialDirections)item.PotentialDirection == Century.Common.Enumerations.DailyAnalysisPotentialDirections.Up)
                    {
                        <text><img src="/Content/themes/default/img/content/tbl/up-green.png" alt="" /></text>
                    }
                    else if ((Century.Common.Enumerations.DailyAnalysisPotentialDirections)item.PotentialDirection == Century.Common.Enumerations.DailyAnalysisPotentialDirections.Down)
                    {
                        <text><img src="/Content/themes/default/img/content/tbl/down_red.png" alt="" /></text>
                    }
                    else
                    {
                        <text><img src="/Content/themes/default/img/content/tbl/right-blue.png" alt="" /></text>
                    }
                </td>
                <td>@item.SupportVal</td>
                <td>@item.Resistance</td>
                <td>@item.ExpiryTime</td>
                <td>@item.KeyLevel</td>
                <td>@item.AlternativeScenario</td>
                <td>@item.Note</td>
                <td nowrap="nowrap">
                    <img src="/Content/themes/admin/img/general/pencil.png" alt="" onclick="editEnrty(@(item.Id));" style="cursor:hand; cursor:pointer;" /> &nbsp;
                    <img src="/Content/themes/admin/img/general/cancel.png" alt="" onclick="if(confirm('Are you sure want to delete entry ?'))deleteEnrty(@(item.Id));" style="cursor:hand; cursor:pointer;" />
                </td>
            </tr>
            }
        }
        else
        {
            <tr>
                <td colspan="10" style="color: Red">There is no <b>Daily Analysis</b> entry for <b>today</b>.</td>
            </tr>
        }
    </tbody>
</table>
